import 'package:flutter/material.dart';

class PopupMenuButtonDemo extends StatefulWidget {
  @override
  _PopupMenuButtonDemoState createState() => _PopupMenuButtonDemoState();
}

class _PopupMenuButtonDemoState extends State<PopupMenuButtonDemo> {
   String _currentSelectStr='Home';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title:Text('PopupMenuButtonDemo'),
          elevation: 0.0,
        ),
        body: Container(
         padding: EdgeInsets.all(100),
         child: Column(
         mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(_currentSelectStr),
            PopupMenuButton(
            onSelected: (value){
              print(value);
              setState(() {
                _currentSelectStr =  value;
              });
            },
            itemBuilder: (
            BuildContext context) => [
              PopupMenuItem(child: Text('Home'),value: 'Home'),
              PopupMenuItem(child: Text('Discove'),value: 'Discove'),
              PopupMenuItem(child: Text('Setting'),value: 'Setting')
            ]
            )

          ],
         ),
        ),
    );
  }
}